

//设置cookie
let setCookie = (name,content,days) =>{
    let date = new Date;
    date.setHours(date.getHours() - 8 ) ;
    date.setDate(date.getDate() + days );
    document.cookie = name + '=' + content + ';path=/;expires=' + date;
}

//获取所有的cookie 
let getCookies = () =>{
    let cookie = document.cookie;
    let arr = cookie.split('; ');
    arr = arr.map( v =>{
        let arr1 = v.split('=');
        return{
            name : arr1[0],
            content : arr1[1]
        }
    })
    return arr;
}

//获取指定的cookie

let getCookie = name =>{
    let arr = getCookies();
    let resObj = arr.filter(v =>{
        return v.name === name;
    })[0]
    if(resObj){
        return resObj.content;
    }else{
        return ''
    }
}


//删除指定的cookie
let removeCookie = name =>{
    setCookie(name , '' , -1);
}